<!DOCTYPE html>
<!--1:js实现四则运算-->
<html>
	<head>
		<meta charset="UTF-8">
		<title>四则运算</title>
		<script type="text/javascript">
			function yunsaun()
			{
				var num1=prompt("请输入第一个数:","");
				var num2=prompt("请输入第二个数:","");
				var fuhao=prompt("请输入运算符","+");
				var result;
				num1=parseFloat(num1);
				num2=parseFloat(num2);
				switch(fuhao)
				{
					case "+":
					result=num1+num2;
					break;
					case "-":
					result=num1-num2;
					break;
					case "*":
					result=num1*num2;
					break;
					case "/":
					result=num1/num2;
					break;
					default:
					result="你输入的符号有误！";					
				}
				alert(num1+fuhao+num2+"="+result);
			}
		</script>
	</head>
	<body>
		<input name="btn" type="button" value="计算两数运算结果" onclick="yunsaun()";/>  
	</body>
</html>
